package com.honey.config;

import java.awt.BasicStroke;  
import java.awt.Color;  
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;  
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;  
import java.io.IOException;
import java.util.Base64;

import javax.imageio.ImageIO;

/** 
 * 二维码 添加 logo图标 处理的方法, 
 * @author honey 
 * 
 */  
public class LogoConfig {  
      
	/** 
     * 设置 logo  
     * @param matrixImage 源二维码图片 
     * @return 返回带有logo的二维码图片 
     * @throws IOException 
     * @author Administrator sangwenhao 
     */  
     public BufferedImage LogoMatrix(BufferedImage matrixImage,String logoSrc) throws IOException{  
         /** 
          * 读取二维码图片，并构建绘图对象 
          */  
         Graphics2D g2 = matrixImage.createGraphics();  
           
         int matrixWidth = matrixImage.getWidth();  
         int matrixHeigh = matrixImage.getHeight();  
           
         /** 
          * 读取Logo图片 
          */  
         File file = new File(logoSrc);
         BufferedImage logo = null;
         if(isImageByExtension(file.getName())) {
        	 logo = ImageIO.read(file);
         }else {
        	 String logo64 = "iVBORw0KGgoAAAANSUhEUgAAAIUAAACFCAYAAAB12js8AAAmc0lEQVR4Xu2dB1gV17r+c+7/nv+9N+3k5MSTcqMpGmNix1hiSzSW2DX23g22WBJ7xYIVe0WNGlFUiiAgIEpRFBBQVFR673XTm+a96xsYslnMrsDeG+V9nhXZm9kza63vN+/3rZnZ5DXoWX/++afS9uLFC8n2/Plzha2srKxOG388+cb3U2z8uPhmSHqNf0NX4ieFb/ykKgOBD5rYSktLa7Xx+1cFCd//+gKHzqHgJ4Fv/CTyE60IAj6AYispKamVxu9XGSh8f6UA4cfNN31KZ1Dwg+YbP2n8pPITzwdHEQDFxcW10vj9KgKF7yc/Dn6c/DzwTR/SCRT8QLWFgQ8AHyQ+kGIrKiqqUeP3pwgUvn+1BYeuVadQ8INTFwZ1QeCDxAdTbIWFhTVq/P4UwaINIPw88POkDzjqDAp+QDWBQRMQxEDS78RgyE+2upLvr9gf2qciUPh+KQKkpnDoQnUCBT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O9YGzDEATVIM/HzpwsgSCqhIPEH0BaMhkvi6onmSHQHXQNBUgsKEn8gdcEQ4ZAHg7ZpkLRobnggxHnUBRAktaEg8QeUAkOEQwoM+TqDfta20y+jaC5oTqTqBx4I+bmubSBIGkFB4g+sDAwRDikwRDho21ddNAe8O/BA8O5QV0CQNIaCxHdAHTB4OOTBeFVdg8Ys7w7qpou6BIKkFRQkviPyYMjDoQwMHg76/asiGisPgzpAyM8xP/+1AQRJayhIfIdUgaEuHLTdyyoamyYw6BoIUo2gIPEdUwSGJq4hD0dtDlZfojHwMKgDhFS6qGsgSDWGgsR3kAdDW9eQTyu0j/om6jOfJtSBQZE76AIIUq1AQeI7KgWHMtdQB4764B7UN9EV1IVBW3eoq3moNShIfIelwNAGDilA6D1DAUQEgfqkCARtYdA1EKRahUIU33kpOKTA0BQOeQeh7WlfdTlZougYdCw6ppQjaAKDMiD4+atrGETVCRQkfiBSYGgKBw+IMkjod+Lky0+wupLvr9gf0QlUQSAPgjYw6BMIUp1BQeIHJN/4SVAHDk0B4UHRtvH70xSE2oBBV0CQ6hQKUfzg1IVDE0CkIFEFi7qN358UBJqAYKgwiNIJFCR+oHzjJ4mfRPkJlgJEChJloGja+P1KQcCDUFMY9AEESWdQiOIHzTd+0vhJlQJEESSKQNGm8ftVBIEUCPUFBlE6h0IUPwl84ydRESCKIFEGiraN378yCKRAMHQYROkNClH8pPCNn1RVgCiDpLYafzxVINQXGETpHYoGGZ7+D60So++C9PB7AAAAAElFTkSuQmCC";
        	 logo = base64ToImage(logo64);
         }
         //开始绘制图片  
         g2.drawImage(logo,matrixWidth/5*2,matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5, null);//绘制       
         BasicStroke stroke = new BasicStroke(5,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);   
         g2.setStroke(stroke);// 设置笔画对象  
         //指定弧度的圆角矩形  
         RoundRectangle2D.Float round = new RoundRectangle2D.Float(matrixWidth/5*2, matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5,20,20);  
         g2.setColor(Color.white);  
         g2.draw(round);// 绘制圆弧矩形  
           
         //设置logo 有一道灰色边框  
         BasicStroke stroke2 = new BasicStroke(0,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);   
         g2.setStroke(stroke2);// 设置笔画对象  
         RoundRectangle2D.Float round2 = new RoundRectangle2D.Float(matrixWidth/5*2+2, matrixHeigh/5*2+2, matrixWidth/5-4, matrixHeigh/5-4,20,20);  
         g2.setColor(Color.white);  
         g2.draw(round2);// 绘制圆弧矩形  
           
         g2.dispose();  
         matrixImage.flush() ;  
         return matrixImage ;  
     }  
     
     public static BufferedImage base64ToImage(String base64) {
         try {
             // Base64解码
             byte[] imageBytes = Base64.getDecoder().decode(base64);
             try (ByteArrayInputStream bais = new ByteArrayInputStream(imageBytes)) {
                 // 将字节流读取为BufferedImage对象，这里假定图片是PNG格式
                 return ImageIO.read(bais);
             }
         } catch (IOException e) {
             e.printStackTrace();
             return null;
         }
     }

	public boolean isImageByExtension(String fileName) {
	    return fileName.toLowerCase().endsWith(".jpg") ||
	           fileName.toLowerCase().endsWith(".jpeg") ||
	           fileName.toLowerCase().endsWith(".png") ||
	           fileName.toLowerCase().endsWith(".gif") ||
	           fileName.toLowerCase().endsWith(".bmp") ||
	           fileName.toLowerCase().endsWith(".tiff");
	}
}
